package com.example.demo.service.task;

import lombok.SneakyThrows;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author: ak
 * @date: 2020/5/5 10:10
 * @description:
 */
public class TaskJob implements Job {
    @Autowired
    TimedTaskService timedTask;

    @SneakyThrows
    @Override
    public void execute(JobExecutionContext jobExecutionContext) {
        //执行逻辑任务,进行统分
        System.out.println("正在统分....");
        System.out.println("任务结束...");
        //任务结束，移除map里面存储的key和data
        timedTask.getTaskMap().remove(jobExecutionContext.getTrigger().getKey().getName());

    }
}